package com.webinsky.folder.persist.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.type.JdbcType;

import com.webinsky.folder.persist.entity.FolderView;

public interface FolderMapper {
	/**
	 * @param name
	 * @param del
	 * @return
	 */
	@SelectProvider( type = FolderSqlProvider.class, method = "selectFolderByNameAndDel")
	@Results({
		@Result(column="id", property="id", jdbcType=JdbcType.INTEGER),
	    @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
	    @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
	})
	List<FolderView> selectViewByNameAndDel(@Param("name")String name, @Param("del")Integer del, @Param("language")String lang, @Param("pageSize")Integer pageSize, @Param("pageStart")Integer pageStart);
	/**
	 * @param name
	 * @param del
	 * @return
	 */
	@SelectProvider( type = FolderSqlProvider.class, method = "selectCountByNameAndDel")
	int selectCountByNameAndDel(@Param("name")String name, @Param("del") int del, @Param("language")String lang);
	
	@SelectProvider( type = FolderSqlProvider.class, method = "selectViewByBookNameAndDel")
	@Results({
		@Result(column="id", property="id", jdbcType=JdbcType.INTEGER),
	    @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
	    @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
	    @Result(column="sort", property="sort", jdbcType=JdbcType.INTEGER),
	})
	List<FolderView> selectViewByBookNameAndDel(@Param("name")String name, @Param("del")Integer del, @Param("language")String lang, @Param("siteId") int siteId, @Param("pageSize")Integer pageSize, @Param("pageStart")Integer pageStart);
	
	@SelectProvider( type = FolderSqlProvider.class, method = "selectCountByBookNameAndDel")
	int selectCountByBookNameAndDel(@Param("name")String name, @Param("del") int del, @Param("language")String lang, @Param("siteId") int siteId);
}
